package com.ndp.fb.rdb.model;

import com.ndp.fb.enums.account.AccountOperateType;
import com.ndp.fb.rdb.annotation.Column;
import com.ndp.fb.rdb.annotation.ColumnType;
import com.ndp.fb.rdb.annotation.Id;
import com.ndp.fb.rdb.annotation.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * Created by elvisxiong on 15/6/9.
 */
@Setter
@Getter
@NoArgsConstructor
@Table("account_operate_history")
public class AccountOperateHistory implements Serializable {

    @Id
    private Long id;

    /**
     * 变更日期
     */
    //date
    private Long date;

    /**
     * 账户操作类型
     */
    @Column(value = "operateType", type = ColumnType.Int)
    private AccountOperateType accountOperateType;
    //accounts
    private String accounts;
    @Column(value = "userId")
    private String userId;

    public void setAccountOperateType(int type){
        switch(type){
            case 0:this.accountOperateType = AccountOperateType.ADD;break;
            case 1:this.accountOperateType = AccountOperateType.UPDATE;break;
            case 2:this.accountOperateType = AccountOperateType.DELETE;break;
            case 3:this.accountOperateType = AccountOperateType.UNBIND;break;
        }
    }
    public void setAccountOperateType(AccountOperateType accountOperateType) {
        this.accountOperateType = accountOperateType;
    }
}
